Skip to content

path: avoid mutable push in join() - #67752

Open
rozzilla wants to merge 2 commits into
nodejs:mainfrom
rozzilla:path-join-no-push
Open

rozzilla wants to merge 2 commits into
nodejs:mainfrom
rozzilla:path-join-no-push

Conversation

@rozzilla

Copy link
Copy Markdown
Contributor

posix.join() and the reserved-name check in win32.join() collected segments with .push() on local arrays, which looks up Array.prototype.push at call time. Use indexed assignments instead. Similar PR as #67748

posix.join() and the reserved-name check in win32.join() collected
segments with .push() on local arrays, which looks up
Array.prototype.push at call time. Replacing that method from user code
made path.join() throw or return a wrong path. Use indexed assignments
instead. win32.join() already uses ArrayPrototypePush for its own
segment list.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/path

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. path Issues and PRs related to the path subsystem. labels Nov 24, 2026
@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.50%. Comparing base (a055d9f) to head (dc74f52).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67752      +/-   ##
==========================================
- Coverage   90.52%   90.50%   -0.02%     
==========================================
  Files         803      805       +2     
  Lines      285110   285756     +646     
  Branches    55037    55166     +129     
==========================================
+ Hits       258101   258632     +531     
- Misses      17143    17220      +77     
- Partials     9866     9904      +38     
Files with missing lines Coverage Δ
lib/path.js 97.55% <100.00%> (ø)

... and 59 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. path Issues and PRs related to the path subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants